<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
.center-block-notinreasonpage {
	display: block;
	margin-right: auto;
	margin-left: auto;
	width: 600px;
	margin-top: 50px;
	margin-bottom: 20px;
	text-align: center;
	padding: 20px 50px;
	border-radius: 10px;
	border: 1px solid #ddd;
	box-shadow: 0 15px 80px rgba(0, 0, 0, .2);
	background-color: white;
}
</style>
</head>
<body>
	<div class="container-fluid">
		<div class="row">
			<div class="col-sm-12">
				<div id="card">
					<div class="center-block-notinreasonpage"  style="position: relative;">
						<div class="row">
							<h1><i class="fa fa-hospital fa-lg text-blue"></i>更新未入组原因</h1>
							<div class="form-horizontal" id="hospForm">
								<div class="form-group">
									<div class="row" style="float:left;padding: 0 15px;">
										<span style="width: 70px; float: left; margin-top: 15px; font-weight: bold; text-align: right;">起始日期:</span>
										<!-- 开始时间 -->
										<div style="float: left; margin: 5px;">
											<input id="outFrom_date" size="16" type="text" readonly="readonly" class="form-control" style="width: 100px; background-color: white; cursor: text;">
										</div>
										<span style="width: 70px; float: left; margin-top: 15px; font-weight: bold; text-align: right;">结束日期:</span>
										<!-- 结束时间 -->
										<div style="float: left; margin: 5px;">
											<input id="outTo_date" size="16" type="text" readonly="readonly" class="form-control" style="width: 100px; background-color: white; cursor: text;">
										</div>
										<button class="btn btn-primary " style="margin-top: 4px; margin-left: 80px; float: left;" onclick="upDateNotInReason()">更新原因</button>
								
									</div>
								</div>
								<div id="percentbar" class="progress" style="width: 100%; float: left; cursor: point; display:none;">
									<div id="percent" class="progress-bar progress-bar-info progress-bar-striped" role="progressbar" aria-valuemin="0" aria-valuemax="100"></div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript">
	
		$("#" + tabId + " #outFrom_date").datetimepicker({
			format : "yyyy-mm-dd",
			autoclose : true,
			todayBtn : true,
			minView : 2,
			language : 'zh-CN',
		});
		$("#" + tabId + " #outTo_date").datetimepicker({
			format : "yyyy-mm-dd",
			autoclose : true,
			todayBtn : true,
			minView : 2,
			language : 'zh-CN',
		});
		function upDateNotInReason() {
			var dateFrom = $("#" + tabId + " #outFrom_date").val();
			var dateTo = $("#" + tabId + " #outTo_date").val();
			
			
			
			
				$("#" + tabId+" #percentbar").css("display","block");
				$("#" + tabId+" #percent").css('width','0%');
				$("#" + tabId+" #percent").html('0%');
				$("#" + tabId+" .btn-primary").html("正在更新……");
				$("#" + tabId+" .btn-primary").attr("disabled","");
			var timer = getUpdateReasonProcess();
			$.post(contextPath + "/drgServiceGroup/updateNotInReason.dhc",{'dateFrom':dateFrom,'dateTo':dateTo}).done(
					function(result) {
						$("#" + tabId+" .btn-primary").html("更新原因");
						$("#" + tabId+" .btn-primary").removeAttr("disabled");
						$("#" + tabId+" #percentbar").css("display","none");
						clearInterval(timer);
					});
		}
		function getUpdateReasonProcess(){
			var timer = setInterval(function(){
				$.get(contextPath+"/drgServiceGroup/getUpdateReasonProcess.dhc").done(function(result){
					var per = result.data;
					var percent = per.percent;
					$("#" + tabId + " #percent").css('width',percent+'%');
					$("#" + tabId + " #percent").html(percent.toFixed(2)+'%');
					if(percent==100)
					{
						clearInterval(timer);
					}
				});
			}, 1000);
			return timer;
		}
	</script>
</body>
</html>